<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>故障处理流程</title>
  <link href="css/layui.css" rel="stylesheet" type="text/css" />
  <link href="css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">
                <p class="title-row"> 故障处理流程</p>
                <form class="layui-form p20 lineBox" action="">
                  <div class="layui-inline">
                    <label class="layui-form-label">故障线路</label>
                                <div class="layui-input-block">
                                    <select name="faultRoute" id="faultRoute" lay-filter="faultRouteFilter">
                                      <option value="">请选择</option>
                                        <option value="1号线">一号线</option>
                                        <option value="2号线">二号线</option>
                                        <option value="3号线">三号线</option>
                                        <option value="4号线">四号线</option>
                                        <option value="5号线">五号线</option>
                                        <option value="6号线">六号线</option>
                                        <option value="7号线">七号线</option>
                                        <option value="8号线">八号线</option>
                                        <option value="9号线">九号线</option>
                                        <option value="10号线">十号线</option>
                                        <option value="11号线">十一号线</option>
                                        <option value="12号线">十二号线</option>
                                        <option value="13号线">十三号线</option>
                                        <option value="14号线">十四号线</option>
                                        <option value="15号线">十五号线</option>
                                        <option value="16号线">十六号线</option>
                                        <option value="17号线">十七号线</option>
                                    </select>
                                </div>
                  </div>
                  <div class="layui-inline">
                    <label class="layui-form-label">故障地点</label>
                    <div class="layui-input-inline">
                      <input type="text" name="faultLocaltion" placeholder="请输入故障地点" autocomplete="off" class="layui-input">
                    </div>
                  </div>
                  <div class="layui-inline">
                    <label class="layui-form-label">故障类型</label>
                    <div class="layui-input-inline">
                      <input type="text" name="faultType" placeholder="请输入故障类型"  autocomplete="off" class="layui-input">
                    </div>
                  </div>
                </form>

            </div>
            <div class="layui-card-body">
                <form class="layui-form" action="">
                  <div class="layui-form-item proBox" style="display: none;">
                    <h3 class="title-row">专业状态选择</h3>
                    <div style="color: #fff; text-align: center; margin:30px 0;" >
                      <input type="checkbox" name="state" title="供电" lay-filter="cOne" class="cOne">
                      <input type="checkbox" name="state" title="车辆" lay-filter="cOne" class="cOne">
                      <input type="checkbox" name="state" title="通号" lay-filter="cOne" class="cOne">
                      <input type="checkbox" name="state" title="工务" lay-filter="cOne" class="cOne">
                      <input type="checkbox" name="state" title="物后" lay-filter="cOne" class="cOne">
                    </div>
                  </div>
                </form>
                <div class="maintenance">
                    <h3 class="title-row">维保总体处理流程</h3>
                    <form class="layui-form" action="">
                        <div class="layui-form-item layui-form-text textBox">
                            <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
                        </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block sumitBtn">
                                <button class="layui-btn confirmButton" lay-submit lay-filter="formDemo" type="button">确认</button>
                                <button type="reset" class="layui-btn layui-btn-primary closePage" type="button">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="fakeTable" style="display: none;">
              <table class="layui-hide" id="fakeTable" lay-filter="fakeTable"></table>
            </div>
        </div>
    </div>
  </div>
  <script src="../static/layui.js"></script>
  <script src="/json/table.js"></script>
  <script src="index.js"></script>
  <script>

    var num = 4;
    //一般直接写在一个js文件中
    layui.use(['layer', 'form', 'table'], function () {
      var layer = layui.layer
        , $ = layui.$
        , table = layui.table //表格
        , form = layui.form;
        
        $('.closePage').on('click', function () {
          closeSonPage();
        });
        
        $('.confirmButton').on('click', function (data) {
          var faultRoute = $("[name='faultRoute']").val();
          var faultLocaltion = $("[name='faultLocaltion']").val();
          var faultType = $("[name='faultType']").val();
          var faultDesc = $("[name='desc']").val();
          if(faultRoute.length<1){
            alertMsg('故障线路必须选择');
            return;
          }
          if(faultDesc.length<1){
            alertMsg('维保总体处理流程必须填写');
            return;
          }
          table.render({
                    elem: '#fakeTable'
                    , url: 'http://127.0.0.1:10110/fault/addFaultPoint'
                    , where: { 'faultLine': faultRoute,
                      'faultLocation':faultLocaltion,
                      'faultType':faultType,
                      'faultContent':faultDesc
                    }
                    , parseData: function (res) {
                      layer.open({
                        type: 1
                        ,offset: 'auto' //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                        ,id: 'layerDemoauto' //防止重复弹出
                        ,content: '<div style="padding: 20px 100px;">'+ res.msg +'</div>'
                        ,btn: '关闭'
                        ,btnAlign: 'c' //按钮居中
                        ,shade: 0 //不显示遮罩
                        ,yes: function(){
                          // layer.close(layer.index);
                          if(res.code=='success'){
                            window.parent.refreshData();
                            layer.closeAll(); 
                            closeSonPage();
                          }else{
                            layer.closeAll('page'); 
                          }
                          
                        }
                      });

                        return {
                            "code": res.code,
                            "msg": res.msg
                        };
                    }
                    , cols: [[
                    ]]
                });
                
        });
        function closeSonPage(){
          var index = parent.layer.getFrameIndex(window.name);
          parent.layer.close(index);//关闭当前页
        }
        
    });

   
    

   

  </script>
</body>

</html>